﻿using CUGroup.IOT.Unit.Helper;
using CUGroup.IOT.Unit.Ilog;
using iot.Jobs;
using iot.Jobs.Entity;
using iot.Models;
using Microsoft.IdentityModel.Tokens;
using Quartz;
using System.Text.Json.Serialization;
using static System.Windows.Forms.AxHost;

namespace CUGroup.IOT.Win.Winform.Jobs
{
    [DisallowConcurrentExecution]
    public class PutKafkaDataJob : IJob
    {
        // Existing code...
        SeriLogHelper.Logger connectionLoggera = new SeriLogHelper.Logger("PLC_Put_Kafka");


        public async Task Execute(IJobExecutionContext context)
        {
            try
            {
                PutKafkaData kafkaData = (PutKafkaData)GlobalQueue.Queue.GetConsumingEnumerable().First();
                connectionLoggera.AppendLog($"推送数据：{kafkaData.ThreadId}");
            }
            catch (Exception ex)
            {
                connectionLoggera.AppendLog(ex.Message);
                throw new Exception(ex.Message);
            }
        }

        public void collectData(object state)
        {
            // Cast the state object to PlcInfo
          
        }
    }
}
